package com.fantastic.service.ysh.impl;

import com.fantastic.common.exception.enums.RespStatusInfo;
import com.fantastic.common.exception.sql.SelectException;
import com.fantastic.common.utils.FilesUtils;
import com.fantastic.common.utils.IsEmptyUtils;
import com.fantastic.mapper.ysh.IntegralVoMapper;
import com.fantastic.model.vo.ysh.IntegralVo;
import com.fantastic.service.ysh.IntegralVoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author yang
 * @date 2024-06-09
 * 积分商城实现类
 */
@Service
public class IntegralVoServiceImpl implements IntegralVoService {
    @Resource
    private IntegralVoMapper integralVoMapper;

    /**
     * 查询积分商城所有商品信息
     * @return
     */
    @Override
    public List<IntegralVo> listIntegralVo() {
        List<IntegralVo> listIntegralVo = integralVoMapper.listIntegralVo();
        IsEmptyUtils.listIsEmpty(new SelectException(RespStatusInfo.SELECT_NULL), listIntegralVo);
        for (IntegralVo list:listIntegralVo){
            if (list.getMember() != null){
                list.getMember().setMemberPic(FilesUtils.getSlashParse(list.getMember().getMemberPic()));
            }

        }
        return listIntegralVo;
    }
}
